package main.java.ensao.cryptography.elgamalmodule;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class ELGAMALGeneratingKeysListner implements ActionListener {
	
	public void actionPerformed(ActionEvent e) {

		
	JPanel pan = (JPanel) ((JButton) e.getSource()).getParent();
		
	pan.setForeground(new Color(255, 255, 10));

    JTextField p = (JTextField) (((JPanel) pan.getComponent(1))).getComponent(1);
	JTextField g = (JTextField) (((JPanel) pan.getComponent(2))).getComponent(1);
	JTextField k = (JTextField) (((JPanel) pan.getComponent(4))).getComponent(1);
	JTextField y = (JTextField) (((JPanel) pan.getComponent(5))).getComponent(1);	
	
	ElGamal gamal=new ElGamal();
	gamal.calcul_keys(p.getText(), g.getText());
			
	k.setText(gamal.getkB().toString());
    y.setText(gamal.getB().toString());

		

	}

}
